package com.czkj.hwz.decorate.adapter;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.czkj.hwz.decorate.R;
import com.czkj.hwz.decorate.base.HttpUrl;
import com.czkj.hwz.decorate.bean.Rows;
import com.king.base.adapter.ViewHolderAdapter;
import com.king.base.adapter.holder.ViewHolder;

import net.tsz.afinal.FinalBitmap;

import java.util.List;

/**
 * 作者：lxm on 2017/10/20 17:13
 * 邮箱：18014168291@189.cn
 * 才智科技
 */
public class SupervisorAdapter extends ViewHolderAdapter<Rows> {
    private static final String TAG = "SupervisorAdapter";
    private List<Rows> listData;
    private FinalBitmap fb;
    public SupervisorAdapter(Context context, List<Rows> listData) {
        super(context, listData);
        this.listData=listData;
        if (fb==null) {
            fb=FinalBitmap.create(context);
            fb.configBitmapMaxHeight(150);
            fb.configBitmapMaxWidth(150);
        }
    }

    @Override
    public View buildConvertView(LayoutInflater layoutInflater, Rows rows, int position, ViewGroup parent) {
        return inflate(R.layout.supervisor_item,parent,false);
    }

    @Override
    public void bindViewDatas(ViewHolder holder, Rows rows, int position) {
        Log.d(TAG, "bindViewDatas: "+holder.toString());
        Log.d(TAG, "bindViewDatas: "+rows.toString());
        Log.d(TAG, "bindViewDatas: "+position);
        holder.setText(R.id.name,rows.getName());
        ImageView iv=holder.getView(R.id.iv);
        fb.display(iv, rows.getUser().getHeadimg());

    }
}
